/**
 * 
 */
package com.orisper.omp.modules.front;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.orisper.dao.Bm_imgDao;
import com.orisper.dao.Bm_imgPO;

import aos.framework.core.typewrap.Dto;
import aos.framework.core.utils.AOSJson;
import aos.framework.web.router.HttpModel;
import aos.system.common.service.AOSBaseService;

/**
 * @author 前端管理
 *
 */
@Service
public class FrontService extends AOSBaseService{
	
	@Autowired
	Bm_imgDao bm_imgDao;
	
	
	/**
	 * 页面首页图片初始化
	 * 
	 * @param httpModel
	 * @return
	 */
	public void initImg(HttpModel httpModel) {
		httpModel.setAttribute("juid", httpModel.getInDto().getString("juid"));
		httpModel.setViewPath("project/orisper/imgManage.jsp");
	}
	

	
	
	/**
	 * 查询首页图片列表
	 * 
	 * @param httpModel
	 */
	public void listImgInfo(HttpModel httpModel) {
		Dto inDto = httpModel.getInDto();
		List<Dto> list = sqlDao.list("Front.imgInfoPage",inDto);
		httpModel.setOutMsg(AOSJson.toGridJson(list, inDto.getPageTotal()));
	}

	/**
	 * 查询首页图片
	 * 
	 * @param httpModel
	 */
	public void getInfo(HttpModel httpModel) {
		Dto dto = sqlDao.list("Front.imgInfoPage",null);
		httpModel.setOutMsg(dto.toString());
	}
	
	
	
	/**
	 * 查询首页图片信息
	 * 
	 * @param httpModel
	 */
	public void getImgInfo(HttpModel httpModel) {
		Dto inDto = httpModel.getInDto();
		Bm_imgPO bm_imgPO = bm_imgDao.selectByKey(inDto.getString("id"));
		httpModel.setOutMsg(AOSJson.toJson(bm_imgPO));
	}
	
	/**
	 * 修改首页图片信息
	 * 
	 * @param httpModel
	 */
	public void updateImgInfo(HttpModel httpModel) {
		Dto inDto = httpModel.getInDto();
		Bm_imgPO bm_imgPO = new Bm_imgPO();
		bm_imgPO.copyProperties(inDto);
		bm_imgDao.updateByKey(bm_imgPO);
		httpModel.setOutMsg("修改成功");
	}
	
	
	
	
}
